import Vue from 'vue';
import Message from './message.vue';

const MessageConstructor=Vue.extend(Message);

const serve=(title,message)=>{
    let messageInstance=new MessageConstructor();
    messageInstance.$mount(document.createElement('div'));
    document.body.appendChild(messageInstance.$el);
    messageInstance.title=title;
    messageInstance.message=message;
    Vue.nextTick(()=>{
        messageInstance.visible=true;
    })
    return messageInstance
}

export default serve;